home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_09_04 / 9n04118a < prev    next >
Text File  |  1991-01-22  |  809b  |  33 lines

  1.  
  2.  2  //    ** nonprtsh.c ** Program to show certain non print characters
  3.  3  //    Based on algorithm by Dr P.J.Plauger CUJ oct 1990 p130
  4.  
  5.  5  #include <stdio.h>
  6.  6  #include <conio.h>
  7.  7  #include <string.h>
  8.  
  9.  9  void printxxx(int c);
  10. 10
  11. 11  void main(void)
  12. 12  {
  13. 13      int a=OxO;
  14. I4
  15. 15      while(a!=0x2a) // end program if * entered
  16. 16           {
  17. 17           printf("\nEnter character:");
  18. 18           a=getch();
  19. 19           printxxx(a);
  20. 20           }
  21. 21  }
  22. 2Z
  23. 23  void printxxx(int c!)
  24. 24  {
  25. 25          static char esc[]="\a\b\t\n\r\x1a\x1b";
  26. 26          static char prt[]="BEL\OBS \OHT \OLF \OCR \OSUB\OESC";
  27. 27          char *s=strchr(esc,c);
  28. 28          if(s)
  29. Zf               printf("[%s]",prt+4*(s-esc));
  30. 30          else
  31. 31               printf("%c",c);
  32. 32  }
  33.